//
//  BrandListModel.swift
//  Pods
//
//  Created by eme on 2017/4/12.
//
//

import UIKit
import SwiftyJSON
import NetWorkCore
import ModelProtocol

class BrandListModel:ModelProtocol{
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kBrandListBrnameKey: String = "brname"
    internal let kBrandListBrdateKey: String = "brdate"
    internal let kBrandListBrlogourlKey: String = "brlogourl"
    internal let kBrandListSortnumKey: String = "sortnum"
    internal let kBrandListBridKey: String = "brid"
    internal let kBrandListBriseffectiveKey: String = "briseffective"
    internal let kBrandListBrinfourlKey: String = "brinfourl"
    internal let kBrandListBrinfoKey: String = "brinfo"
    internal let kBrandListBrcodeKey: String = "brcode"
    
    
    // MARK: 属性
    var brname: String
    var brdate: String
    var brlogourl: String
    var sortnum: Int
    var brid: String
    var briseffective: String
    var brinfourl: String
    var brinfo: String
    var brcode: String
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        brname = json[kBrandListBrnameKey].stringValue
        brdate = json[kBrandListBrdateKey].stringValue
        brlogourl = json[kBrandListBrlogourlKey].stringValue
        sortnum = json[kBrandListSortnumKey].intValue
        brid = json[kBrandListBridKey].stringValue
        briseffective = json[kBrandListBriseffectiveKey].stringValue
        brinfourl = json[kBrandListBrinfourlKey].stringValue
        brinfo = json[kBrandListBrinfoKey].stringValue
        brcode = json[kBrandListBrcodeKey].stringValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(brname as AnyObject, forKey: kBrandListBrnameKey)
    
        dictionary.updateValue(brdate as AnyObject, forKey: kBrandListBrdateKey)
    
        dictionary.updateValue(brlogourl as AnyObject, forKey: kBrandListBrlogourlKey)
    
        dictionary.updateValue(sortnum as AnyObject, forKey: kBrandListSortnumKey)
    
        dictionary.updateValue(brid as AnyObject, forKey: kBrandListBridKey)
    
        dictionary.updateValue(briseffective as AnyObject, forKey: kBrandListBriseffectiveKey)
    
        dictionary.updateValue(brinfourl as AnyObject, forKey: kBrandListBrinfourlKey)
    
        dictionary.updateValue(brinfo as AnyObject, forKey: kBrandListBrinfoKey)
    
        dictionary.updateValue(brcode as AnyObject, forKey: kBrandListBrcodeKey)
    
        
        return dictionary
    }
    
    
}
